package punctuatedEquilibriumTest;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import punctuatedEquilibrium.ArrayComparator;
import punctuatedEquilibrium.Trait;
import punctuatedEquilibrium.TraitFactory;

public class ArrayComparatorTest extends ArrayComparator {
	@Test
	public void testArraysEqual() {
		Trait[] expected = TraitFactory.getArrayOfTraits();
		Trait[] actual = TraitFactory.getArrayOfTraits();
		assertTrue("arrays from the same factory method call should be equivalent", ArrayComparator.arraysEquivalent(expected, actual));
	}

	@Test
	public void testArrayAreNotEqual() {
		Trait[] expected = TraitFactory.getArrayOfTraits();
		Trait[] actual = TraitFactory.getTraitsOfValueZero();
		assertFalse("arrays from different factory method calls should be different",ArrayComparator.arraysEquivalent(expected, actual));
	}

	@Test
	public void testArraysAlsoNotEqual() {
		Trait[] expected = TraitFactory.getArrayOfTraits();
		int differentLength = expected.length + 1;
		Trait[] actual = new Trait[differentLength];
		assertFalse("arrays of different length should be different", ArrayComparator.arraysEquivalent(expected, actual));
	}
}
